package zhoug.demo.player;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;


import androidx.annotation.LayoutRes;
import androidx.appcompat.app.AppCompatActivity;
import zhoug.common.utils.ToastUtils;
import zhoug.logging.Logger;

public abstract class MyBaseActivity extends AppCompatActivity {
    protected static final String TAG = ">>>MyBaseActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutResId());
        findViews();
        onCreate1(savedInstanceState);
    }

    protected abstract @LayoutRes int getLayoutResId();

    protected abstract void findViews();

    protected abstract void onCreate1(Bundle savedInstanceState);

    protected void toActivity(Class<? extends Activity> clz, Bundle args) {
        Intent intent = new Intent(this, clz);
        if (args != null) {
            intent.putExtras(args);
        }
        startActivity(intent);
    }

    protected void toast(String msg){
        Logger.d(TAG, msg);
        ToastUtils.toastShort(this,msg);
    }

}
